package com.naihe.anderson.sms.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import android.text.TextUtils;

import com.naihe.anderson.sms.application.NhSmsApp;

public class ContactUser implements Serializable ,Comparable<ContactUser> {
	//serialVersionUID
	private static final long serialVersionUID = -6581367158695406795L;
	public static final String CONTACT_ID = "contactId";
	public static final String NAME = "name";
	public static final String PHOTO_ID = "photoId";
	public static final String NUMBERS = "numbers";
	
	private long contactId;
	private String name;
	private long photoId;
	private String numbers;
	private String chineseNameCode;
	private List<String> numberList; 
	private int heightBegin;
	private int heightCount;
	private String searchNumber;
	
	public ContactUser() {
		contactId = 0;
		name = "";
		photoId = 0;
		numbers = "";
		chineseNameCode = "";
		numberList = new ArrayList<String>();
	}
	
	public String getChineseNameCode() {
		return chineseNameCode;
	}
	public void setChineseNameCode(String chineseNameCode) {
		this.chineseNameCode = chineseNameCode;
	}
	
	public String getNumbers() {
		if(TextUtils.isEmpty(numbers)){
			if(numberList != null && numberList.size() > 0){
				numbers = numberList.toString();
			}
		}
		return numbers;
	}
	
	public void setNumbers(String numbers) {
		this.numbers = numbers;
	}
	public long getContactId() {
		return contactId;
	}
	public void setContactId(long contactId) {
		this.contactId = contactId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public long getPhotoId() {
		return photoId;
	}
	public void setPhotoId(long photoId) {
		this.photoId = photoId;
	}
	public List<String> getNumberList() {
		if(numberList == null || numberList.size() == 0){
			if(!TextUtils.isEmpty(numbers)){
				String[] numberArr = numbers.split(",");
				if(numberArr != null && numberArr.length > 0){
					numberList = new ArrayList<String>();
					for(int i = 0; i < numberArr.length; i ++){
						numberList.add(numberArr[i]);
					}
				}
			}
		}
		return numberList;
	}
	public void setNumberList(List<String> numberList) {
		this.numberList = numberList;
	}
	public int getHeightCount() {
		return heightCount;
	}
	public void setHeightCount(int heightCount) {
		this.heightCount = heightCount;
	}
	public int getHeightBegin() {
		return heightBegin;
	}
	public void setHeightBegin(int heightBegin) {
		this.heightBegin = heightBegin;
	}
	
	@Override
	public int compareTo(ContactUser another) {
		return NhSmsApp.collator.compare(getName(), another.getName());
	}

	public String getSearchNumber() {
		return searchNumber;
	}

	public void setSearchNumber(String searchNumber) {
		this.searchNumber = searchNumber;
	}
	
}
